package com.molichuxing.services.property;

public enum VehiclePowerTypeEnum {
    /**
     * 纯电
     */
    BATTERY_ELECTRIC (1, "纯电"),
    /**
     * 燃油
     */
    FUEL(2, "燃油");


    int value;
    String name;

    VehiclePowerTypeEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }


    /**
     * 通过value获取枚举的name
     *
     * @param value
     * @return
     */
    public static String getName(int value) {
        VehiclePowerTypeEnum enumerate = getEnum(value);
        return enumerate == null ? null : enumerate.getName();
    }

    /**
     * 通过value获取枚举
     *
     * @param value
     * @return
     */
    public static VehiclePowerTypeEnum getEnum(int value) {
        for (VehiclePowerTypeEnum enumerate : VehiclePowerTypeEnum.values()) {
            if (enumerate.getValue() == value) {
                return enumerate;
            }
        }
        return null;
    }
    
}
